import 'package:flutter/material.dart';
import 'package:untitled9/sign-in_page.dart';

class Page0 extends StatefulWidget {
  const Page0({super.key});

  @override
  State<Page0> createState() => _Page0State();
}

class _Page0State extends State<Page0> {
  PageController? _controller;
  var Pageindex = 0;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _controller = PageController();
  }

  @override
  Widget build(BuildContext context) {
    double scrW = MediaQuery.of(context).size.width;
    double scrH = MediaQuery.of(context).size.height;
    return Scaffold(
        body: Stack(
      children: [
        PageView(
          controller: _controller,
          onPageChanged: (index) {
            setState(() {});
            Pageindex = index;
          },
          children: [
            Container(
              color: Color.fromRGBO(222, 190, 191, 1.0),
              child: const Center(
                child: Text(
                  'IMAGE',
                  style: TextStyle(fontSize: 60, color: Colors.grey),
                ),
              ),
            ),
            Container(
              color: Color.fromRGBO(210, 108, 109, 1.0),
              child: const Center(
                child: Text(
                  'IMAGE',
                  style: TextStyle(fontSize: 60, color: Colors.grey),
                ),
              ),
            ),
            Stack(
              children: [
                Container(
                  color: Color.fromRGBO(172, 172, 173, 1.0),
                  child: const Center(
                    child: Text(
                      'IMAGE',
                      style: TextStyle(fontSize: 60, color: Colors.grey),
                    ),
                  ),
                ),
                Positioned(
                    bottom: 180,
                    left: scrW / 2 - 75,
                    child: GestureDetector(
                      onTap: () {
                        Navigator.push(context,
                            MaterialPageRoute(builder: (context) {
                          return SignInPage();
                        }));
                      },
                      child: Container(
                        width: 150,
                        height: 50,
                        child: Center(child: Text('START')),
                        decoration: BoxDecoration(
                            color: Colors.white,
                            borderRadius: BorderRadius.circular(20)),
                      ),
                    ))
              ],
            ),
          ],
        ),
        Positioned(
            bottom: 0,
            child: Stack(
              children: [
                Container(
                  width: scrW,
                  height: 100,
                  color: Colors.white,
                ),
                Positioned(
                  top: 25,
                  left: scrW / 2 - 25,
                  child: Container(
                    width: 50,
                    height: 50,
                    decoration: BoxDecoration(
                        border: Border.all(width: 1, color: Colors.grey)),
                    child: Center(
                      child: Text('LOGO'),
                    ),
                  ),
                )
              ],
            )),
        Positioned(
            bottom: 130,
            left: scrW / 2 - 45,
            child: Container(
              width: 90,
              height: 20,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Container(
                    width: 20,
                    height: 20,
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(10),
                      border: Border.all(width: .5),
                      color: Pageindex == 0
                          ? Colors.white
                          : Colors.white.withOpacity(0),
                    ),
                  ),
                  Container(
                    width: 20,
                    height: 20,
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(10),
                      border: Border.all(width: .5),
                      color: Pageindex == 1
                          ? Colors.white
                          : Colors.white.withOpacity(0),
                    ),
                  ),
                  Container(
                    width: 20,
                    height: 20,
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(10),
                      border: Border.all(width: .5),
                      color: Pageindex == 2
                          ? Colors.white
                          : Colors.white.withOpacity(0),
                    ),
                  ),
                ],
              ),
            ))
      ],
    ));
  }
}
